using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;

namespace Integrator.DAL
{
    public class CentraSpeciProduct
    {
        public string connString = "Server=localhost;Database=Integrator;User ID=sa;Password=sa;Connection Reset=FALSE;Min Pool Size=2;Connection Lifetime=120;Connection Timeout=60;";
        public string TenSPCuThe= string.Empty;
        public string NgayHieuLuc= string.Empty;
        public string NgayHetHan= string.Empty;
        public string MucVayThapNhat= string.Empty;
        public string MucVayCaoNhat= string.Empty;
        public string MucVayMacDinh= string.Empty;
        public string ThoiGianToiThieu= string.Empty;
        public string ThoiGianToiDa= string.Empty;
        public string ThoiGianMacDinh= string.Empty;
        public string TuoiToiThieu= string.Empty;
        public string TuoiToiDa= string.Empty;
        public string LSTrongHan= string.Empty;
        public string ThuNhapToiThieu= string.Empty;
        public string QuocTich= string.Empty;
        public string NguoiCungVay= string.Empty;
        public string NguoiBaoLanh= string.Empty;
        public string GioTinh= string.Empty;
        public string LaiSuat= string.Empty;
        public string DinhKyTinhLai= string.Empty;
        public string TinhLaiNgayDaoHan= string.Empty;
        public string KhachHangTrungNhau= string.Empty;
        public string TinhLaiNgayNghi= string.Empty;
        public string MonVayLienKetTKCKH= string.Empty;
        public string MonVayLienKetTKTG= string.Empty;
        public string PhiTatToan= string.Empty;
        public string TuDongDaoHan= string.Empty;
        public string TGAnHanKhiDaoHan= string.Empty;
        public string SoDuGocToiThieuDaoHan= string.Empty;
        public string TongSoDuToiThieuDaoHan= string.Empty;
        public string QuyTacNgayNghi= string.Empty;
        public string PhamViDanToc= string.Empty;
        public string TGChoDuyet= string.Empty;
        public string TGChoGiaiNgan= string.Empty;
        public string ChamDiemTinDung= string.Empty;
        public string TGAnHan= string.Empty;
        public string PhanBoLaiAnHan= string.Empty;
        public string DinhKyThuLaiNgoaiBang= string.Empty;
        public string TraTungPhan= string.Empty;
        public string GL= string.Empty;
        public string LuuVu= string.Empty;
        public string UyThac= string.Empty;
        public string PhiUyThac= string.Empty;
        public string PhiHoaHong= string.Empty;
        public string VungChoVay= string.Empty;
        public string TyLeXulyRuiRo= string.Empty;
        public string CapXulyRuiRo= string.Empty;
        public string DoiTuongThuHuong= string.Empty;
        public string PhanBoLai= string.Empty;
        public string GiamLaiTraGocTruoc= string.Empty;
        public string PhanTramVonGoc= string.Empty;
        public string LaiQuaHan= string.Empty;
        public string TyLePhanBoUyThac= string.Empty;

        public void Save()
        {
            SqlConnection conn = new SqlConnection(connString);
            try
            {
                conn.Open();
                SqlCommand cmd = new SqlCommand("INSERT INTO [dbo].[tblSanPhamCuTheTW]([TenSPCuThe],[NgayHieuLuc],[NgayHetHan],[MucVayThapNhat],[MucVayCaoNhat],[MucVayMacDinh],[ThoiGianToiThieu],[ThoiGianToiDa],[ThoiGianMacDinh],[TuoiToiThieu],[TuoiToiDa],[LSTrongHan],[ThuNhapToiThieu],[QuocTich],[NguoiCungVay],[NguoiBaoLanh],[GioTinh],[LaiSuat],[DinhKyTinhLai],[TinhLaiNgayDaoHan],[KhachHangTrungNhau],[TinhLaiNgayNghi],[MonVayLienKetTKCKH],[MonVayLienKetTKTG],[PhiTatToan],[TuDongDaoHan],[TGAnHanKhiDaoHan],[SoDuGocToiThieuDaoHan],[TongSoDuToiThieuDaoHan],[QuyTacNgayNghi],[PhamViDanToc],[TGChoDuyet],[TGChoGiaiNgan],[ChamDiemTinDung],[TGAnHan],[PhanBoLaiAnHan],[DinhKyThuLaiNgoaiBang],[TraTungPhan],[GL],[LuuVu],[UyThac],[PhiUyThac],[PhiHoaHong],[VungChoVay],[TyLeXulyRuiRo],[CapXulyRuiRo],[DoiTuongThuHuong],[PhanBoLai],[GiamLaiTraGocTruoc],[PhanTramVonGoc],[LaiQuaHan],[TyLePhanBoUyThac])VALUES(@TenSPCuThe,@NgayHieuLuc,@NgayHetHan,@MucVayThapNhat,@MucVayCaoNhat,@MucVayMacDinh,@ThoiGianToiThieu,@ThoiGianToiDa,@ThoiGianMacDinh,@TuoiToiThieu,@TuoiToiDa,@LSTrongHan,@ThuNhapToiThieu,@QuocTich,@NguoiCungVay,@NguoiBaoLanh,@GioTinh,@LaiSuat,@DinhKyTinhLai,@TinhLaiNgayDaoHan,@KhachHangTrungNhau,@TinhLaiNgayNghi,@MonVayLienKetTKCKH,@MonVayLienKetTKTG,@PhiTatToan,@TuDongDaoHan,@TGAnHanKhiDaoHan,@SoDuGocToiThieuDaoHan,@TongSoDuToiThieuDaoHan,@QuyTacNgayNghi,@PhamViDanToc,@TGChoDuyet,@TGChoGiaiNgan,@ChamDiemTinDung,@TGAnHan,@PhanBoLaiAnHan,@DinhKyThuLaiNgoaiBang,@TraTungPhan,@GL,@LuuVu,@UyThac,@PhiUyThac,@PhiHoaHong,@VungChoVay,@TyLeXulyRuiRo,@CapXulyRuiRo,@DoiTuongThuHuong,@PhanBoLai,@GiamLaiTraGocTruoc,@PhanTramVonGoc,@LaiQuaHan,@TyLePhanBoUyThac)", conn);
                cmd.Parameters.AddWithValue("@TenSPCuThe", TenSPCuThe);
                cmd.Parameters.AddWithValue("@NgayHieuLuc", NgayHieuLuc);
                cmd.Parameters.AddWithValue("@NgayHetHan", NgayHetHan);
                cmd.Parameters.AddWithValue("@MucVayThapNhat", MucVayThapNhat);
                cmd.Parameters.AddWithValue("@MucVayCaoNhat", MucVayCaoNhat);
                cmd.Parameters.AddWithValue("@MucVayMacDinh", MucVayMacDinh);
                cmd.Parameters.AddWithValue("@ThoiGianToiThieu", ThoiGianToiThieu);
                cmd.Parameters.AddWithValue("@ThoiGianToiDa", ThoiGianToiDa);
                cmd.Parameters.AddWithValue("@ThoiGianMacDinh", ThoiGianMacDinh);
                cmd.Parameters.AddWithValue("@TuoiToiThieu", TuoiToiThieu);
                cmd.Parameters.AddWithValue("@TuoiToiDa", TuoiToiDa);
                cmd.Parameters.AddWithValue("@LSTrongHan", LSTrongHan);
                cmd.Parameters.AddWithValue("@ThuNhapToiThieu", ThuNhapToiThieu);
                cmd.Parameters.AddWithValue("@QuocTich", QuocTich);
                cmd.Parameters.AddWithValue("@NguoiCungVay", NguoiCungVay);
                cmd.Parameters.AddWithValue("@NguoiBaoLanh", NguoiBaoLanh);
                cmd.Parameters.AddWithValue("@GioTinh", GioTinh);
                cmd.Parameters.AddWithValue("@LaiSuat", LaiSuat);
                cmd.Parameters.AddWithValue("@DinhKyTinhLai", DinhKyTinhLai);
                cmd.Parameters.AddWithValue("@TinhLaiNgayDaoHan", TinhLaiNgayDaoHan);
                cmd.Parameters.AddWithValue("@KhachHangTrungNhau", KhachHangTrungNhau);
                cmd.Parameters.AddWithValue("@TinhLaiNgayNghi", TinhLaiNgayNghi);
                cmd.Parameters.AddWithValue("@MonVayLienKetTKCKH", MonVayLienKetTKCKH);
                cmd.Parameters.AddWithValue("@MonVayLienKetTKTG", MonVayLienKetTKTG);
                cmd.Parameters.AddWithValue("@PhiTatToan", PhiTatToan);
                cmd.Parameters.AddWithValue("@TuDongDaoHan", TuDongDaoHan);
                cmd.Parameters.AddWithValue("@TGAnHanKhiDaoHan", TGAnHanKhiDaoHan);
                cmd.Parameters.AddWithValue("@SoDuGocToiThieuDaoHan", SoDuGocToiThieuDaoHan);
                cmd.Parameters.AddWithValue("@TongSoDuToiThieuDaoHan", TongSoDuToiThieuDaoHan);
                cmd.Parameters.AddWithValue("@QuyTacNgayNghi", QuyTacNgayNghi);
                cmd.Parameters.AddWithValue("@PhamViDanToc", PhamViDanToc);
                cmd.Parameters.AddWithValue("@TGChoDuyet", TGChoDuyet);
                cmd.Parameters.AddWithValue("@TGChoGiaiNgan", TGChoGiaiNgan);
                cmd.Parameters.AddWithValue("@ChamDiemTinDung", ChamDiemTinDung);
                cmd.Parameters.AddWithValue("@TGAnHan", TGAnHan);
                cmd.Parameters.AddWithValue("@PhanBoLaiAnHan", PhanBoLaiAnHan);
                cmd.Parameters.AddWithValue("@DinhKyThuLaiNgoaiBang", DinhKyThuLaiNgoaiBang);
                cmd.Parameters.AddWithValue("@TraTungPhan", TraTungPhan);
                cmd.Parameters.AddWithValue("@GL", GL);
                cmd.Parameters.AddWithValue("@LuuVu", LuuVu);
                cmd.Parameters.AddWithValue("@UyThac", UyThac);
                cmd.Parameters.AddWithValue("@PhiUyThac", PhiUyThac);
                cmd.Parameters.AddWithValue("@PhiHoaHong", PhiHoaHong);
                cmd.Parameters.AddWithValue("@VungChoVay", VungChoVay);
                cmd.Parameters.AddWithValue("@TyLeXulyRuiRo", TyLeXulyRuiRo);
                cmd.Parameters.AddWithValue("@CapXulyRuiRo", CapXulyRuiRo);
                cmd.Parameters.AddWithValue("@DoiTuongThuHuong", DoiTuongThuHuong);
                cmd.Parameters.AddWithValue("@PhanBoLai", PhanBoLai);
                cmd.Parameters.AddWithValue("@GiamLaiTraGocTruoc", GiamLaiTraGocTruoc);
                cmd.Parameters.AddWithValue("@PhanTramVonGoc", PhanTramVonGoc);
                cmd.Parameters.AddWithValue("@LaiQuaHan", LaiQuaHan);
                cmd.Parameters.AddWithValue("@TyLePhanBoUyThac", TyLePhanBoUyThac);
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }
        }
    }
}